package com.example.springboot.request;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;

public class PageRequest {
    @NotNull(message = "【页码】不能为空")
    private Integer page;

    //添加参数校验，防止size过大导致一次性查出过多数据使服务器崩溃
    @NotNull(message = "【每页条数】不能为空")
    @Max(value=1000,message = "【每页条数】不能超过1000")
    private Integer size;

    public Integer getPage() {
        return page;
    }

    public Integer getSize() {
        return size;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return "PageRequest{" +
                "page=" + page +
                ", size=" + size +
                '}';
    }
}